﻿using MediatR;
using SystemHYS.API.Application.command.GualityProjectCommand;
using SystemHYS.Infrstructre.Interface;
namespace SystemHYS.API.Application.commandler.GualityProjectCommandler
{
    public class GualityProjectUpdateCommandler:IRequestHandler<GualityProjectUpdateCommand,int>
    {
        IGualityProjectRepository GroupRepository;
        public GualityProjectUpdateCommandler(IGualityProjectRepository GroupRepository)
        {
            this.GroupRepository = GroupRepository;
        }

        public async Task<int> Handle(GualityProjectUpdateCommand request, CancellationToken cancellationToken)
        {
            var list = await GroupRepository.GetModelAsnc(request.gualityProjectId);
                list.gualityProjectName=request.gualityProjectName;
            list.gualityProjectNumbering=request.gualityProjectNumbering;
            list.gualityProjectTool=request.gualityProjectTool;
            list.gualityProjectMethod=request.gualityProjectMethod;
            list.gualityProjectType = request.gualityProjectType;
            list.gualityProjectStandardValue=request.gualityProjectStandardValue;
            list.gualityProjectRemark=request.gualityProjectRemark;
            list.UpdateName = "李明";
            list.UpdateTime= DateTime.Now.ToUniversalTime();
            return await GroupRepository.UpdateAsyn(list);
        }
    }
}
